package com.jine.dubboconsumer2;

import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import test.TestInterface2;

/**
 * DemoConsumerController
 * 消费者控制层
 * @author xiaoze
 * @date 2018/6/7
 */
@RestController
public class DemoConsumerController {

    @Reference(version = "${demo.service.version}")
    private TestInterface2 demoService;

    @RequestMapping("/test/{num1}/{num2}")
    public String sayHello(@PathVariable("num1") String num1,@PathVariable("num2") String num2) {
        int n1 = Integer.parseInt(num1);
        int n2 = Integer.parseInt(num2);
        long s = demoService.add(n1,n2);
        return String.valueOf(s);
    }

}
